package com.nokia.position;

import java.io.IOException;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

public class PositionServiceUsageUSA2Reducer extends
		Reducer<Text, PositionServiceUsageUSA2Writable, Text, Text> {

	static final int PERCENTILE = 95;

	protected void reduce(Text key,
			Iterable<PositionServiceUsageUSA2Writable> values, Context context)
			throws IOException, InterruptedException {

		int totalServiceCnt = 0;
		
		for (PositionServiceUsageUSA2Writable value : values) {
			totalServiceCnt += value.getTotalCount();
		}

		context.write(key, new Text(Integer.toString(totalServiceCnt)));
	}

}
